<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新增文章</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.edit {
	background-color:#FFFFFF;
	padding:6px;
	border-bottom:2px solid #BEC6CE;
	border-right:2px solid #BEC6CE;
	border-top:1px solid #cccccc;
	border-left:1px solid #cccccc;
	margin:0 0 10px 0;
}
.edit table {
	width:100%;
}
.edit table th {
	background-color:#FAF0D0;
	text-align:right;
	width:150px;
	height:35px;
	line-height:25px;
	border-bottom:#ffffff 1px solid;
	border-right:#cccccc 1px solid;
	font-weight:100;
	font-size:14px;
}
.edit table td {
	border-bottom:#cccccc 1px solid;
	border-right:#cccccc 1px solid;
	font-size:12px;
	color:#666666;
	text-align:left;
	padding:5px 5px 5px 7px;
}
#upload_queue {
	position:absolute;
	background-color:#CFF;
	border:1px solid #09F;
	height:10px;
	margin-bottom:10px;
	padding:10px;
	overflow:hidden;
	width:374px;
	display:none
}
.img_pre_img {
	border:1px solid #09F;
	display:inline-block;
	margin:2px;
	height:60px;
	overflow:hidden;
	width:100px;
}
.img_prev_orginal {
	position:absolute;
	margin-bottom:0px;
	width:600px;
	height:auto;
	border:1px solid #00F;
	background:#FFC
}
#file_uploadQueue {
	position:relative;
	background:#FFF;
	z-index:911119999;
}
#cancel_all_button {
	position:absolute;
	margin-left:385px;
	margin-top:-8px;
	z-index:100000;
	border:0px;
	display:none
}
#startupload:hover {
	background:none;
	outline:none;
}
.img_remove:hover {
	background:none;
	outline:none;
}
.uploadifyError {
	background-color:#FDE5DD !important;
	border:2px solid #FBCBBC !important;
}
.uploadifyQueueItem {
	background-color:#F5F5F5;
	border:1px solid #09C;
	font:11px Verdana, Geneva, sans-serif;
	margin-top:2px;
	padding:1px;
	width:250px;
}
</style>
<{insert_scripts files="./js/jquery.min.js,swfobject.js,jquery.uploadify.v2.1.4.min.js,./include/kindeditor/kindeditor-min.js,./include/kindeditor/lang/zh_CN.js"}>
<script type="text/javascript">
        var editor;
		var options = {
        cssPath : '/include/kindeditor/examples/index.css',
        filterMode : true,
		allowFileManager : true
		};
        KindEditor.ready(function(K) {
                editor = K.create('#editor_id', {
                        themeType : 'common',
						uploadJson : './index.php?c=upload&a=upload_json',
						fileManagerJson : './index.php?c=upload&a=file_manager_json',
						allowFileManager : true
                });
        });		
</script>
</head>
<body>
<form name="Form1" method="post" action="./index.php?c=admin&a=article&mod=edit&act=saveAction" id="Form1" enctype="multipart/form-data">
  <div class="box">
    <div class=box2>
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <th style="border-bottom: #cccccc 1px solid">归类：</th>
          <td width="200"><label for="article_classify"></label>
            <select name="article_classify" id="article_classify">
              <option value="0">无（作为单页面发布）</option>
              <option value="1" selected="selected">新闻资讯-->>近期工程</option>
              <option value="2" >新闻资讯-->>装修小贴士</option>
              <option value="3" >新闻资讯-->>风水知识</option>
            </select></td>
          <td ></td>
        </tr>
      </table>
    </div>
    <div class=box2>
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <th id='html_title'>文章标题：</th>
          <td><input  name="title" id="title" type="text" value="" style="width:320px" /></td>
        </tr>
        <tr>
          <th style="border-bottom: #cccccc 1px solid">排序：</th>
          <td><input  name="show_order" id="show_order" type="text" value="0" style="width:160px"  />
            <font color="#990000">(tip:数值越大排序越靠前，对单页面该排序不起作用）</font></td>
        </tr>
      </table>
    </div>
    <div class=box2 id="meta_box">
      <table border=0 cellpadding=0 cellspacing=0 >
        <tr>
          <th >META_KEYWORDS<br />
            (页面关键词)：</th>
          <td><input  name="meta_keywords" id="meta_keywords" type="text" value="" style="width:320px" /></td>
        </tr>
        <tr>
          <th style="border-bottom: #cccccc 1px solid">META_DESCRIPTION<br />
            (页面描述)： </th>
          <td><textarea name="meta_description" style="width:320px; height: 60px"></textarea></td>
        </tr>
      </table>
    </div>
    <div class=box3 id="listUploadDiv">
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <th id='html_title'>近期工程图片：</th>
          <td><div id="img_pre"></div>
            <input type="hidden" id="article_upload_img" name="article_upload_img"  value="" />
            <input type="hidden" id="article_delete_img" name="article_delete_img"  value="" />
            <div id="uploadbtn" style="width:680px; height:40px;"><span id="btn_main" style="display:block; width:120px; height:30px; float:left; margin-top:5px;">
              <input id="file_upload2" type="file" name="file_upload" />
              </span><span id="btn_start" style=" display:block;margin-top:5px;float:left; line-height:30px; padding-left:20px; "><a id="startupload" href="javascript:$('#file_upload2').uploadifyUpload();"><img style="border:0px;" src="./images/upload.jpg" alt="点此上传"/></a></span><span id="upl_dis" style=" display:block;margin-top:5px;float:left; line-height:30px; padding-left:20px; ">[上传****的大图缩略图将自动生成]</span> </div>
            <div id="cancel_all_button"><a href="javascript:void('0')" id="cancel_all_button_a"><img  style="border:0px;" src="include/uploadify/cancel.png" /></a></div>
            <div id="upload_queue"></div></td>
        </tr>
      </table>
    </div>
    <div class="edit">
      <table border=0 cellpadding=0 cellspacing=0>
        <tr id="thumbDiv" style="display:none" >
          <th style="border-bottom: #cccccc 1px solid"><br />
            缩略图： </th>
          <td><div  id="image_input_holder" >
              <input  name="article_brief" id="article_brief" type="text"  style="width:320px;" value="<{if $res.product_thumb}><{$res.product_thumb}><{/if}>" readonly="readonly"/>
            </div>
            <div id="uploadbtn" style="width:680px; height:40px;"><span id="btn_main" style="display:block; width:120px; height:30px; float:left; margin-top:10px;">
              <input id="file_upload" type="file" name="file_upload" />
              </span><span id="btn_dis" style=" display:block;margin-top:10px; float:left; line-height:30px; padding-left:20px; ">【提示:非必须，推荐文章请上传图片后点击推荐按钮;图片尺寸请控制为70px*70px】</span></div></td>
        </tr>
        <tr>
          <th > <div class="edit_box"> 文章内容： </div>
          </th>
          <td><div class="edit_box">
              <textarea id="editor_id" name="article_content" style="width:680px;height:300px;">
在这里编辑文章主要内容，请填写完整之后再保存！
</textarea>
            </div></td>
        </tr>
      </table>
    </div>
    <input name="c_column" type="text" value="" style="display:none" />
  </div>
  <p style="padding: 15px; text-align: center;">
    <input type="submit" name="Button1" value="保存" id="Button1" class="add" style="font-weight:bold;width:70px;" />
    <input type="reset" name="Button3" value="重置 " id="Button3" class="add" style="font-weight:bold;width:70px;" />
  </p>
</form>
<script type="text/javascript">
$(function(){
$("#article_classify").change(function(){
	if($("#article_classify").val()==0){
		$("#listUploadDiv").slideUp("slow");
		$("#thumbDiv").delay(200).slideUp("slow");
		$("input[name='show_order'] ").attr("readonly",true);
	}else if($("#article_classify").val()==1){
		$("#listUploadDiv").show();
		$("#thumbDiv").delay(200).slideUp("slow");
		$("input[name='show_order'] ").attr("readonly",false);
	}else{
		$("#listUploadDiv").slideUp("fast");
		$("#thumbDiv").show();
	}	
	});	
/**************************************************************************************************************/
	var imgtemp='';
	var imgnum=0;
	var imgArr  = new Array();
	var imgDel  = new Array();
	var imgError= new Array();
$("#cancel_all_button_a").bind("click",function(){
	$('#file_upload2').uploadifyClearQueue();
	$(this).parent().hide();
	})
$(".img_remove").live("mouseover",function(){
	$(this).parent().parent().append("<div class='img_prev_orginal'><img style='max-width:600px'  src='"+$(this).children("img").attr("src").replace("thumb/","")+"'/></div>");
	});	
$(".img_remove").live("mouseout",function(){
	$(".img_prev_orginal").remove();
	});		
$(".img_remove").live("click",function(){
	$(this).parent().fadeOut("slow");
		imgDel.push($(this).children("img").attr("src").replace('/upload/image/','').replace('thumb/',''));
		$("#article_delete_img").val(imgDel);
	});		
 $('#file_upload2').uploadify({
    'uploader'  : './include/uploadify/uploadify.swf',
    'script'    : './upload.php/1:1:0:0',
    'cancelImg' : './include/uploadify/cancel.png',
    'folder'    : './upload/images/',
	'fileExt'   : '*.jpg;*.gif;*.png',
	'fileDesc'    : '请选择图片,可多选',
	'buttonImg' : './include/uploadify/button.jpg',
	'sizeLimit'   : 1024000,
	'queueID'        : 'upload_queue',	
    'auto'      :  false,
	'multi'     :  true,
	'onSelect'    : function(event,ID,fileObj) {
		 $("#btn_start").show();
		 $("#upload_queue").show();
		 $("#cancel_all_button").show();
		 $(".ke-statusbar").css("z-index","-10")
      //alert('The file ' + fileObj.name + ' was added to the queue.');
    },
	'onSelectOnce' : function(event,data) {
      imgnum=data.fileCount;
	  $("#upload_queue").css("height",imgnum*36)
    },
	 'onCancel'    : function(event,ID,fileObj,data) {
		imgnum--; 
		 $("#upload_queue").css("height",parseInt($("#upload_queue").css("height").replace('px',''))-36);
      if(imgnum==0){
		$("#upload_queue").slideUp("slow"); 
		$(".ke-statusbar").css("z-index","10")
		  }
    },
  	'onComplete'  : function(event, ID, fileObj, response, data) {
		$("#upload_queue").css("height",parseInt($("#upload_queue").css("height").replace('px',''))-36);
	//$("#uploadbtn").hide("fast");
  if(response.match(/\/upload\//)){
	  imgArr.push(response.replace('/upload/image/',''));
	  
	$("#img_pre").append("<span class='img_pre_img'><a class='img_remove' href='javascript:void(0)'><img style='border:0px' src='"+response.replace(/(\d+)\/(.*?)/g,"$1/thumb/$2")+"'/></a></span>");
	 }else{//出错信息
	 imgError.push(response);
	 }
	//$("#btn_main").hide();
     $("#uploadbtn").css("height","40px");
    },
	 'onAllComplete' : function(event,data) {
		 $("#upload_queue,#cancel_all_button").hide();
      //alert(imgtemp.match(/(.*?)+[a-z]+/ig));
	  $("#upl_dis").html("<font color=red>[提示：以上为成功上传的图片，鼠标移至缩略图上方可查看大图，单击可以取消该图片]</font>");
	  $("#article_upload_img").val(imgArr);
	  if(imgError.length!=0){
	  var i=0;
	  var Errorelert='上传中出现以下错误:\n';
	  for(i=0;i<imgError.length;i++){
		 Errorelert+=imgError[i]+"\n";
		 }
		 alert(Errorelert);//提示错误信息
	  }
    },
	  'onError'     : function (event,ID,fileObj,errorObj) {
      alert(errorObj.type + ' 错误: ' + errorObj.info);
    }
	
  });
/**************************************************************************************************************/
	
	
	
	
 $('#file_upload').uploadify({
    'uploader'  : './include/uploadify/uploadify.swf',
    'script'    : './upload.php/1:0:0:0',
    'cancelImg' : './include/uploadify/cancel.png',
    'folder'    : './upload/images/',
	'fileExt'   : '*.jpg;*.gif;*.png',
	'fileDesc'    : 'Image Files',
	'buttonImg' : './include/uploadify/button.jpg',
	'sizeLimit'   : 1024000,
    'auto'      :  true,
  	'onComplete'  : function(event, ID, fileObj, response, data) {
		if(response.match(/\/upload\//)){
			$("#article_brief").val(response.match(/\/upload\/(.+)/g));
			$("#btn_dis").html("<font color=red>[提示：图片已经成功上传，请勿修改上面文本框中的链接]</font>");
			$("#image_input_holder").show();
		}else{
			alert(response);
		}
    },
	  'onError'     : function (event,ID,fileObj,errorObj) {
      alert(errorObj.type + ' 错误: ' + errorObj.info);
    }
	
  });	
});	
</script>
<!-- $Id: article_add.html 2012-04-05 wengcanvip@qq.com $ -->
</body>
</html>
